export const LoadingMessages = [
  'Loading... leave your YAML at the door.',
  "I can explain YAML to you, but I can't make you understand it.",
  "I'm not superstitious, but I always sacrifice a YAML file while loading...",
  "Remember: It's not a production outage, it's a learning opportunity.",
  'YAML: Where indentation errors go to reproduce like rabbits.',
  'This loading screen is more forgiving than your YAML.',
  "May your YAML be ever in your favor. But let's be real, it probably won't be.",
  "Stared at YAML so long, I can see the Matrix. It's all just nested lists.",
  'YAML: The only language that can make you question your sanity.',
  "I'd rather fight a thousand regex bosses than debug one YAML file.",
  'YAML: The silent killer of productivity... and joy, and hope.',
  'Loading... or is this just another YAML parsing error?',
  'YAML: embrace the nihilism.',
  "Here's to hoping all your deployments are as painless as this loading screen.",
  'Loading... please hold - just like your hopes and dreams do when you open a YAML file.',
  "Don't worry, this won't hurt as much as accidentally deleting a line in your YAML.",
  'YAML: Given to jumpers to push them over the edge.',
  'Loading... or is this just your life flashing before your eyes after a YAML error?',
  'At least this loading message is in plain English, unlike your YAML.',
  'May your coffee be strong and your YAML be valid. We both know one of these will never happen.',
  'What are you YAMLing on about now?',
  'If you can read this, your YAML is probably fine. At least for now.',
  'Loading... Please enjoy these tranquil moments away from YAML.',
  'YAML: Where dreams go to syntax error.',
  'This loading screen is temporary. Your YAML-induced suffering is eternal.',
  "Don't worry, this loading screen won't judge your YAML... unlike your coworkers.",
  "YAML: The only language that can make you nostalgic for XML. And that's saying something.",
  'This is fine. Everything is fine. Except for your YAML, probably.',
  'Loading... Please use this time to reflect on your life choices that led you to YAML.',
  "May your code be bug-free and your YAML be... well, less buggy. We can't expect miracles.",
  'This loading screen is more consistent than your YAML indentation. Ouch.',
  'YAML: The perfect metaphor for the futility of existence.',
  "Loading... Please don't give up on your dreams. Unless they involve YAML.",
  'This loading screen is your safe space from the tyranny of YAML. Cherish it.',
  'Loading... Please remain calm. The YAML-induced panic will subside... eventually.',
  "Don't worry, your secrets are safe with us. Unlike your YAML, which will betray you at the worst possible moment.",
  'YAML: The only language that can make you long for the sweet embrace of death.',
  "This is fine. Everything is fine. Except for the inevitable YAML parsing error that's about to ruin your day.",
  'Loading... Please use this time to write your will. You never know what might happen when you open that YAML file.',
  'May your code be elegant and your YAML be... well, at least parsable. We have to set realistic goals.',
  'This loading screen is more reliable than your YAML. Sad, but true.',
  'YAML: The embodiment of entropy in the digital world.',
  'Loading... Please take a deep breath and repeat after me: "I am not my YAML."',
  'This loading screen is a tribute to all the developers who lost their sanity to YAML.',
  'Tip: Use Meshery extensions to open terminal sessions with your pods.',
  'Tip: Customize and extend Meshery with plugins, adapters, and models.',
  'Tip: You can create your own Meshery models.',
  'Tip: Designs can be cloned. Designs can also be merged.',
  'Tip: Designs can be exported as JSON files or OCI images.',
  'Tip: Find existing or publish your own Meshery Design on Artifact Hub',
  'Designs can be snapshotted. Snapshots are immutable. Snapshots can be compared for differences between Design versions.',
  'Tip: Share your designs and collaborate with colleagues.',
  'Tip: Publish reusable designs to the Meshery Catalog.',
  'Tip: Designs are versioned. Each time a Design is saved, a new version is created.',
  'Tip: By default, any user of a Workspace can deploy a Design.',
  'Tip: Validate your design to ensure proper syntax and component configuration.',
  'Tip: Dry-run your design before deploying for a preview.',
  'Tip: Designs can be filtered and viewed as a live-running deployment in your Environments.',
  'Tip: Designs can be grouped into Workspaces, shared among teams and deployed to Environments.',
  'Tip: Designs can be converted into reusable patterns. Patterns can be shared with other users or teams.',
  'Tip: Relationships characterize how components are connected and interact with each other.',
  'Tip: Relationships are defined in Meshery Models to ensure their accuracy and specificity.',
  'Tip: Meshery is inherently cognizant of the interrelationships between components in your designs.',
  'Connect Meshery to your clusters and discover insights.',
  'mesheryctl is a powerful CLI tool for interacting with one or more Meshery Servers.',
];

export const getRandomLoadingMessage = () => {
  return LoadingMessages[Math.floor(Math.random() * LoadingMessages.length)];
};

/**
 * Get a persisted loading message from the window object, or generate a new one
 * This ensures that the same loading message is used across all loading screens
 * in the app, including UI extensions.
 */
export const getPersistedLoadingMessage = () => {
  if (typeof window !== 'undefined') {
    if (!window.__mesheryLoadingMessage) {
      window.__mesheryLoadingMessage = getRandomLoadingMessage();
    }
    return window.__mesheryLoadingMessage;
  }
  // Fallback for server-side rendering
  return getRandomLoadingMessage();
};

export const randomLoadingMessage = getPersistedLoadingMessage(); // random per app load, persisted in window
